package com.xonro.common.histrans.sfeg.job.update;

import com.actionsoft.bpms.commons.database.RowMap;
import com.actionsoft.bpms.schedule.IJob;
import com.actionsoft.bpms.util.DBSql;
import com.actionsoft.sdk.local.SDK;
import com.xonro.common.histrans.base.consts.SfegConst;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;

import java.util.List;

public class updateContractPay implements IJob {
    @Override
    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
        List<RowMap> contractMap = DBSql.getMaps("SELECT ID,APPLY_NO  FROM BO_XR_CFM_CONTRACT_PAY ");

        for(RowMap map:contractMap){
            String applyNo=map.getString("APPLY_NO");
            String id=map.getString("ID");
            SDK.getLogAPI().consoleInfo("打印申请号======="+applyNo);
            RowMap accountMap = SDK.getCCAPI().getRDSAPI(SfegConst.CCID).getMap("SELECT * FROM tb_ContractMoneyOut  WHERE  cmoCode='"+applyNo+"' ");
            String isSubmit =accountMap.getString("isSubmit");
            SDK.getLogAPI().consoleInfo("获取修改的申请单号===="+applyNo);
            SDK.getLogAPI().consoleInfo("获取修改状态===="+isSubmit);
            if("3".equals(isSubmit)) {
                SDK.getLogAPI().consoleInfo("获取修改的申请单号===="+applyNo);
                DBSql.update("UPDATE BO_XR_CFM_CONTRACT_PAY SET PROCESS_FLAG='4' WHERE ID='" + id + "' ");
            }


        }

    }
}
